<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DOM更新与事件触发</title>
</head>
<body>
    <div id="content"></div>
    <script>
        var xhr = new XMLHttpRequest();
        xhr.open('GET',"data.txt",true);
        xhr.onreadystatechange = function(){
            if(xhr.readyState == 4 && xhr.status == 200){
                document.getElementById("content").innerHTML = xhr.responseText;
            }
        }
        xhr.send();
    </script>
</body>
</html>